<?php defined('IN_ADMIN') or exit('Access Denied!'); ?>
<div class="subnav">
  <div class="content-menu ib-a blue line-x">
    <a href="javascript:window.top._MP(121,'/admin/dish/list/<?=$shop_id;?>');" class="on"><em>菜品管理</em></a> <span>|</span>
    <a href="javascript:window.top._MP(122,'/admin/dish_cat/list/<?=$shop_id;?>');"><em>菜品分类</em></a> <span>|</span>
    <a href="#" onclick="show_dialog('add', '/admin/dish/import/<?=$shop_id;?>', '批量添加新菜品')"><em>批量添加新菜品</em></a>
  </div>
</div>
<form name="myform" action="/admin/dish/sortlist/<?=$shop_id;?>" method="post">
  <div class="pad_10">
    <div class="table-list">
      <table width="100%" cellspacing="0">
        <thead>
          <tr>
            <th width="38">排序</th>
            <th width="30">Id</th>
            <th>名称</th>
            <th>价格(元)</th>
            <th>管理操作</th>
          </tr>
        </thead>
        <tbody>
    <?php
    if(is_array($list) && count($list)){
      foreach($list as $catid => $dishes){
          $catname = isset($cats[$catid]) ? $cats[$catid]['cat_name'] : '未分类';
    ?>
        <tr><td></td><td colspan="5" height="32" align="left"><b><?=h($catname);?></b></td></tr>
        <?php
          foreach($dishes as $item){
        ?>
          <tr>
            <td align="center"><input name="sorts[<?=$item['dish_id'];?>]" type="text" size="3" value="<?=$item['ordnum'];?>" class="input-text-c"></td>
            <td align="center"><?=$item['dish_id'];?></td>
            <td><?=h($item['name']);?></td>
            <td align="center"><?=sprintf('%0.2f', $item['price']);?></td>
            <td align="center">
                <a href="/admin/dish/modify/<?=$item['shop_id'];?>-<?=$item['dish_id'];?>">编辑</a>
                  <span>|</span>
                <a href="/admin/dish/delete/<?=$shop_id;?>?dish_id=<?=$item['dish_id'];?>" onclick="return confirm('确定要删除该项目?')">删除</a>
            </td>
          </tr>
    <?php
            }
         }
      }else{
    ?>
            <tr><td colspan="5" height="50" align="center">暂无数据</td></tr>
    <?php } ?>
         </tbody>
      </table>
      <?php if(is_array($list) && count($list)){ ?>
      <div class="btn">
        <input type="submit" class="button" name="dosubmit" value="排序" />
      </div>
      <?php } ?>
    </div>
  </div>
</form>
